import Vue from 'vue'
import VueResource from  'vue-resource'
import Router from 'vue-router'
import Home from '../components/Home.vue'
import Stylist from '../components/stylist.vue'
import ShoppingCart from '../components/ShoppingCart.vue'
import My from '../components/My.vue'
import Seek from '../components/Seek.vue'
import Classes_template from '../components/Classes_template.vue'
import Need from '../components/Need.vue'
import Stylist_shop from '../components/Stylist_shop.vue'
import Product_details from '../components/Product_details.vue'
import Order from '../components/Order_item.vue'
import Account from '../components/Individual_account.vue'
import Draw_money from '../components/Draw_money.vue'
import Recharge_money from '../components/Recharge_money.vue'
import Addcode from '../components/Add_code.vue'
import Favorite from '../components/Favorite.vue'
import Need_message from '../components/Need_message.vue'
import Feedback from '../components/Feedback.vue'
import Address from '../components/Address.vue'
import Login from '../components/Login'
import Add_address from '../components/Add_address'
Vue.use(Router);
Vue.use(VueResource);
const router = new Router({
  routes: [
    {
      path: '*',
      component: Home,
    },
    {
      path: '/home',
      component: Home,
    },
    {
      path: '/stylist',
      component: Stylist
    },
    {
      path: '/shoppingCart',
      component: ShoppingCart
    },
    {
      path: '/my',
      component: My
    },
    {
      path: '/seek',
      component: Seek
    },
    {
      path: '/classes_template',
      component: Classes_template
    },
    {
      path: '/need',
      component: Need
    },
    {
      path: '/stylist_shop',
      component: Stylist_shop
    },
    {
      path: '/product_details',
      component: Product_details
    },
    {
      path: '/order/:id',//订单详情
      component: Order
    },
    {
      path: '/account',//个人账户
      component: Account
    },
    {
      path: '/rechargeMoney',//充值页面
      component: Recharge_money
    },
    {
      path: '/drawMoney',//提现页面
      component: Draw_money
    },
    {
      path: '/addcode',//添加银行卡
      component: Addcode
    },
    {
      path: '/address',//地址管理
      component: Address
    },,
    {
      path: '/favorite',//收藏夹
      component: Favorite
    },
    {
      path: '/need_message',//品牌定制
      component: Need_message
    },
    {
      path: '/feedback',//意见反馈
      component: Feedback
    },
    {
      path: '/login',//登录
      component: Login
    },
    {
      path: '/add_address',//添加地址
      component: Add_address
    }
  ]
})
// router.beforeEach((to, from, next) => {
//     var getUrlParam = function(name) {
//         var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
//         var r = window.location.search.substr(1).match(reg);
//         if (r != null) return unescape(r[2]);
//         return null;
//
//     }
//
//     // console.log($route.meta);
//     if(0){
//        if(localStorage.getItem('loginMessage')){
//            console.log('已登录');
//            next()
//
//        }else {
//            console.log('未登录');
//            next({path:'/login'});
//
//        }
//    }else {
//       next()
//    }
//
// })
export default router;



